Patch by Nischay Nahata whom I have mentored earlier this week.
* Nx.devnull
* Nikola Kovacs
* Nikolaos S. Karastathis
+* Nischay Nahata
* Olaf Lenz
* Olivier Finlay Beaton
* Paul Copperman
contentSub, ... The same div often also contains the class mw-content-ltr/rtl.
* (bug 27619) Remove preference option to display broken links as link?
* (bug 34896) Update jQuery JSON plugin to v2.3 (2011-09-17)
+* (bug 34302) Add CSS classes to email fields in user preferences
=== Bug fixes in 1.20 ===
* (bug 30245) Use the correct way to construct a log page title.
$emailAddress .= $emailAddress == '' ? $link : " ($link)";
}
+
$defaultPreferences['emailaddress'] = array(
'type' => 'info',
'raw' => true,
'default' => $emailAddress,
'label-message' => 'youremail',
'section' => 'personal/email',
+ # 'cssclass' chosen below
);
$disableEmailPrefs = false;
+ $emailauthenticationclass = 'mw-email-not-authenticated';
if ( $wgEmailAuthentication ) {
if ( $user->getEmail() ) {
if ( $user->getEmailAuthenticationTimestamp() ) {
$emailauthenticated = $context->msg( 'emailauthenticated',
$time, $d, $t )->parse() . '<br />';
$disableEmailPrefs = false;
+ $emailauthenticationclass = 'mw-email-authenticated';
} else {
$disableEmailPrefs = true;
$emailauthenticated = $context->msg( 'emailnotauthenticated' )->parse() . '<br />' .
SpecialPage::getTitleFor( 'Confirmemail' ),
$context->msg( 'emailconfirmlink' )->escaped()
) . '<br />';
+ $emailauthenticationclass="mw-email-not-authenticated";
}
} else {
$disableEmailPrefs = true;
$emailauthenticated = $context->msg( 'noemailprefs' )->escaped();
+ $emailauthenticationclass = 'mw-email-none';
}
$defaultPreferences['emailauthentication'] = array(
'section' => 'personal/email',
'label-message' => 'prefs-emailconfirm-label',
'default' => $emailauthenticated,
+ # Apply the same CSS class used on the input to the message:
+ 'cssclass' => $emailauthenticationclass,
);
-
}
+ $defaultPreferences['emailaddress']['cssclass'] = $emailauthenticationclass;
if ( $wgEnableUserEmail && $user->isAllowed( 'sendemail' ) ) {
$defaultPreferences['disablemail'] = array(
),
'mediawiki.special.preferences' => array(
'scripts' => 'resources/mediawiki.special/mediawiki.special.preferences.js',
+ 'styles' => 'resources/mediawiki.special/mediawiki.special.preferences.css',
),
'mediawiki.special.recentchanges' => array(
'scripts' => 'resources/mediawiki.special/mediawiki.special.recentchanges.js',
border-bottom-right-radius: 0.8em;
border-top-right-radius: 0.8em;
}
+
+/** colors also used in mediawiki.special.preferences.css */
#mw-emailaddress-validity.valid {
border: 1px solid #80FF80;
background-color: #C0FFC0;
--- /dev/null
+/** Reuses colors from mediawiki.special.changeemail.css */
+.mw-email-not-authenticated .mw-input,
+.mw-email-none .mw-input{
+ border: 1px solid #FF8080;
+ background-color: #FFC0C0;
+ color: black;
+}
+/** Authenticated email field has its own class too. Unstyled by default */
+/*
+.mw-email-authenticated .mw-input { }
+*/
*/
function testEmailFieldsWhenUserHasNoEmail() {
$prefs = $this->prefsFor( 'noemail' );
- $this->assertArrayNotHasKey( 'class',
+ $this->assertArrayHasKey( 'cssclass',
$prefs['emailaddress']
);
+ $this->assertEquals( 'mw-email-none', $prefs['emailaddress']['cssclass'] );
}
/**
* Placeholder to verify bug 34302
*/
function testEmailFieldsWhenUserEmailNotAuthenticated() {
$prefs = $this->prefsFor( 'notauth' );
- $this->assertArrayNotHasKey( 'class',
+ $this->assertArrayHasKey( 'cssclass',
$prefs['emailaddress']
);
+ $this->assertEquals( 'mw-email-not-authenticated', $prefs['emailaddress']['cssclass'] );
}
/**
* Placeholder to verify bug 34302
*/
function testEmailFieldsWhenUserEmailIsAuthenticated() {
$prefs = $this->prefsFor( 'auth' );
- $this->assertArrayNotHasKey( 'class',
+ $this->assertArrayHasKey( 'cssclass',
$prefs['emailaddress']
);
+ $this->assertEquals( 'mw-email-authenticated', $prefs['emailaddress']['cssclass'] );
}